/*
 * @Author: wuzhouhai wzh200x@126.com
 * @Date: 2025-04-07 14:56:12
 * @LastEditors: wuzhouhai wzh200x@126.com
 * @LastEditTime: 2025-04-07 15:23:27
 * @FilePath: \tars\HyperNexus\log\LogHelper.go
 * @Description:
 */
package hyperNexusCommon

import (
	"github.com/TarsCloud/TarsGo/tars"
	"github.com/TarsCloud/TarsGo/tars/util/rogger"
)

type HyperNexusLog struct {
	MapLogs map[string]*rogger.Logger
}

func (h *HyperNexusLog) Init() error {
	h.MapLogs["HyperNuexus"] = tars.GetDayLogger("HyperNuexus", 1)
	return nil
}

func (h *HyperNexusLog) SetLevel(lv rogger.LogLevel) {
	rogger.SetLevel(lv)
}

func (h *HyperNexusLog) GetLogger(name string) *rogger.Logger {
	if logger, ok := h.MapLogs[name]; ok {
		return logger
	}
	h.MapLogs[name] = tars.GetDayLogger(name, 1)
	return h.MapLogs[name]
}

func (h *HyperNexusLog) GetDefaultLogger() *rogger.Logger {
	return tars.GetLogger("HyperNuexus")
}

func NewHyperNexusLog() *HyperNexusLog {
	l := &HyperNexusLog{
		MapLogs: make(map[string]*rogger.Logger),
	}
	err := l.Init()
	if err != nil {
		return nil
	}
	return l
}

var HyperNexusLogIns = NewHyperNexusLog()
